package mysql

import "gorm.io/gorm"

type Order struct {
	gorm.Model
	UserId      int64   `gorm:"type:int;comment:用户id"`
	OrderSn     string  `gorm:"type:varchar(36);unique;comment:订单号"`
	PayType     int64   `gorm:"type:tinyint(1);default:1;comment:支付类型:1:支付宝,2:微信"`
	PayTime     string  `gorm:"type:datetime(3);not null;comment:支付时间"`
	Amount      float64 `gorm:"type:decimal(10,2);default:0.00;comment:价格"`
	OrderStatus int64   `gorm:"type:tinyint(1);default:1;comment:状态:1:待支付,2:已支付,3:已取消,4:已退款,5:已完成"`
}

func (o *Order) Create() error {
	return Db.Create(&o).Error
}
